//2009/07/27 12:46:01
#include <iostream>
#include <string>
#include <vector>

using namespace std;

class InterestingDigits
{
public:
    vector <int> digits(int base)
    {
		vector<int> list;
		list.clear();
		for(int i=2; i<base; i++)
		{
			if(interesting(i,base))
				list.push_back(i);
		}
		return list;
    }
	private:
	bool interesting(int num, int base)
	{
		if(base % num == 1)
			return true;
		return false;
	}
};
/*
 * Whoa! Wait a second, how can that work? Assume a digit D is interesting 
 * (that is, if A is a multiple of D, then so is the digit sum of A) in base B, and that B%D=1. 
 * Let Ai be digit i in A - that is, A = A0*B0 + A1*B1 + ... We have: 
 * 
 * A0*B0 + A1*B1 + A2*B2 + ... ≡ 0 (mod D)
 * But since B ≡ 1 (mod D), we also have Bn ≡ 1 (mod D), so:
 * 
 * A0 + A1 + A2 + ... ≡ 0 (mod D)
 * And thus the digit sum of A is a multiple of D. 
 * It's slightly trickier to prove that if B%D is not 1, 
 * then D is not an interesting number.
 * */
